package com.yao.spider.core.util;

import java.util.concurrent.*;

/**
 * Created by 单耀 on 2017/12/10.
 */
public class SimpleThreadPoolExecutor extends ThreadPoolExecutor{
    private String threadPoolName;

    public SimpleThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
    }

    public SimpleThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
    }

    /**
     *
     * @param corePoolSize 核心线程池大小
     * @param maximumPoolSize 最大线程池大小
     * @param keepAliveTime 线程池中超过corePoolSize数目的空闲线程最大存活时间；
     * @param unit keepAliveTime时间单位
     * @param workQueue 阻塞任务队列
     * @param handler 当提交任务数超过maxmumPoolSize+workQueue之和时，任务会交给RejectedExecutionHandler来处理
     * @param threadPoolName
     */
    public SimpleThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler,String threadPoolName) {

        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);

        this.threadPoolName = threadPoolName;
    }

    public SimpleThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
    }

    public SimpleThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit seconds, LinkedBlockingQueue<Runnable> workQueue, String threadpoolName) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, seconds, workQueue);
        this.threadPoolName = threadpoolName;
    }
}
